package org.example.elmfront.service.Imp;

import org.example.elmfront.entity.Product;
import org.example.elmfront.mapper.ProductMapper;
import org.example.elmfront.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Product> findAllProducts() {
        return productMapper.findAllProducts();
    }

    @Override
    public Product findProductById(Long id) {
        return productMapper.findProductById(id);
    }

    @Override
    public List<Product> getProductsByRestaurantId(Long restaurantId) {
        return productMapper.findProductsByRestaurantId(restaurantId);
    }


    @Override
    public void insertProduct(Product product) {
        productMapper.insertProduct(product);
    }

    @Override
    public void updateProduct(Product product) {
        productMapper.updateProduct(product);
    }

    @Override
    public void deleteProductById(Long id) {
        productMapper.deleteProductById(id);
    }
}
